Recursive Ascent-Descent Parsing

نویسنده

  • R. Nigel Horspool
چکیده

Generalized left-corner parsing was originally presented as a technique for generating a parser for the SLR(1) class of grammars but with far fewer states than the SLR(1) parser. This paper modi es and extends the formulation of left-corner parsers so that it is possible to apply the technique to the LALR(1) and LR(1) classes of grammars. It is further shown that left-corner parsers can be converted into directly executed code in a manner that subsumes the parsing methods known as recursive descent and recursive ascent { hence the name recursive ascent-descent. The directly executed form has the advantage that it allows a compiler writer to insert semantic code into the parser incrementally, without having to re-execute the parser generator. Index Terms compilers, parsers, left-corner parsing, recursive descent, recursive ascent.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

ScalaBison Recursive Ascent - Descent Parser Generator

ScalaBison is a parser generator accepting bison syntax and generating a parser in Scala. The generated parser uses the idea of “recursive ascent-descent parsing,” that is, directly encoded generalized left-corner parsing. Of interest is that fact that the parser is generated from the LALR(1) tables created by bison, thus enabling extensions such as precedence to be handled implicitly.

متن کامل

Non-deterministic Recursive Ascent Parsing

A purely functional implementation of LR-parsers is given, together with a simple correctness proof. It is presented as a generalization of the recursive descent parser. For non-LR grammars the time-complexity of our parser is cubic if the functions that constitute the parser are implemented as memo-functions, i.e. functions that memorize the results of previous invocations. Memo-functions also...

متن کامل

CPS Recursive Ascent Parsing

The parsing problem is ubiquitous in Computer Science. Perhaps that is part of the reason it has been used so frequently to illustrate the power of continuations and monads. It is often the case, though, that the parser examples of continuation passing style and monads are top-down parsers. I intend to show that the continuation passing style of programming naturally leads to bottom-up or recur...

متن کامل

Direct Left-Recursive Parsing Expression Grammars

Parsing Expression Grammars (PEGs) are specifications of unambiguous recursive-descent style parsers. PEGs incorporate both lexing and parsing phases and have valuable properties, such as being closed under composition. In common with most recursive-descent systems, raw PEGs cannot handle left-recursion; traditional approaches to left-recursion elimination lead to incorrect parses. In this pape...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:
  • Comput. Lang.

دوره 18  شماره 

صفحات  -

تاریخ انتشار 1993